package com.zhx.business.base;

import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;

@Data
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class BaseEntity  implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = -3521673552808391992L;
    /**
     * 数据库主键
     */
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    private String uid;
    //创建时间
    @CreatedDate
    private Date createTime;
    //修改时间
    @LastModifiedDate
    private Date updateTime;
    //创建者
    private String createBy;
    //修改者
    private String updateBy;
}
